﻿<%@ Page Language="C#" MasterPageFile="~/Samples.master"  Codebehind="CommonControls.aspx.cs"
	Inherits="Sample.CommonControls" Title="Folks Common Controls Sample" %>

<asp:Content ID="commonContent" ContentPlaceHolderID="bodyContentPlaceHolder" runat="server">
	<div id="app">
		<h3>CheckBoxList</h3>
		<asp:CheckBoxList ID="sampleCheckBoxList" rel="folks" runat="server" AutoPostBack="True"
			OnSelectedIndexChanged="sampleCheckBoxList_SelectedIndexChanged" RepeatDirection="Horizontal">
			<asp:ListItem>Item 1</asp:ListItem>
			<asp:ListItem>Item 2</asp:ListItem>
			<asp:ListItem>Item 3</asp:ListItem>
		</asp:CheckBoxList>
		<asp:Label ID="sampleCheckBoxLabel" runat="server"></asp:Label>
		<hr size="1" />
		<h3>RadioButtonList and ListBox</h3>
		<folks:FolksContainer ID="radioListBoxFolksContainer" runat="server">
			<table border="0">
				<tr>
					<td>
						<asp:RadioButtonList ID="sampleRadioButtonList" runat="server" AutoPostBack="True"
							OnSelectedIndexChanged="sampleRadioButtonList_SelectedIndexChanged" rel="folks">
							<asp:ListItem Value="1">South America</asp:ListItem>
							<asp:ListItem Value="2">North America</asp:ListItem>
						</asp:RadioButtonList>
					</td>
					<td>
						<asp:ListBox rel="folks" ID="sampleListBox" runat="server" AutoPostBack="True" OnSelectedIndexChanged="sampleListBox_SelectedIndexChanged">
							<asp:ListItem Value="1">Brazil</asp:ListItem>
							<asp:ListItem Value="2">United States</asp:ListItem>
						</asp:ListBox>
					</td>
				</tr>
			</table>
		</folks:FolksContainer>
		<hr size="1" />
		<h3>Calendar</h3>
		<folks:FolksContainer ID="calendarFolksContainer" runat="server">
			<asp:Calendar ID="sampleCalendar" runat="server" Width="350px" OnSelectionChanged="sampleCalendar_SelectionChanged"
				NextPrevFormat="FullMonth" Height="190px" ForeColor="Black" Font-Size="9pt" Font-Names="Verdana"
				BorderWidth="1px" BorderColor="White" BackColor="White">
				<SelectedDayStyle BackColor="#333399" ForeColor="White" />
				<TodayDayStyle BackColor="#CCCCCC" />
				<OtherMonthDayStyle ForeColor="#999999" />
				<NextPrevStyle Font-Bold="True" Font-Size="8pt" ForeColor="#333333" VerticalAlign="Bottom" />
				<DayHeaderStyle Font-Bold="True" Font-Size="8pt" />
				<TitleStyle BackColor="White" BorderColor="Black" BorderWidth="4px" Font-Bold="True"
					Font-Size="12pt" ForeColor="#333399" />
			</asp:Calendar>
			<asp:Label ID="sampleLabel" runat="server"></asp:Label>
		</folks:FolksContainer>
	</div>
	<div id="aspx">
		<h4>ASPX</h4>
		<pre class="code_fixed sh_html">
&lt;h3&gt;CheckBoxList&lt;/h3&gt;
&lt;asp:CheckBoxList ID="CheckBoxList1" <strong>rel="folks"</strong> runat="server" AutoPostBack="True"
	OnSelectedIndexChanged="sampleCheckBoxList_SelectedIndexChanged" RepeatDirection="Horizontal"&gt;
	&lt;asp:ListItem&gt;Item 1&lt;/asp:ListItem&gt;
	&lt;asp:ListItem&gt;Item 2&lt;/asp:ListItem&gt;
	&lt;asp:ListItem&gt;Item 3&lt;/asp:ListItem&gt;
&lt;/asp:CheckBoxList&gt;
&lt;asp:Label ID="Label1" runat="server"&gt;&lt;/asp:Label&gt;
&lt;hr size="1" /&gt;
&lt;h3&gt;RadioButtonList and ListBox&lt;/h3&gt; <strong>
&lt;folks:FolksContainer ID="FolksContainer1" runat="server"&gt;</strong>
	&lt;table border="0"&gt;
		&lt;tr&gt;
			&lt;td&gt;
				&lt;asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True"
					OnSelectedIndexChanged="sampleRadioButtonList_SelectedIndexChanged" &gt;
					&lt;asp:ListItem Value="1"&gt;South America&lt;/asp:ListItem&gt;
					&lt;asp:ListItem Value="2"&gt;North America&lt;/asp:ListItem&gt;
				&lt;/asp:RadioButtonList&gt;
			&lt;/td&gt;
			&lt;td&gt;
				&lt;asp:ListBox ID="ListBox1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="sampleListBox_SelectedIndexChanged"&gt;
					&lt;asp:ListItem Value="1"&gt;Brazil&lt;/asp:ListItem&gt;
					&lt;asp:ListItem Value="2"&gt;United States&lt;/asp:ListItem&gt;
				&lt;/asp:ListBox&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;
<strong>&lt;/folks:FolksContainer&gt;</strong>
&lt;hr size="1" /&gt;
&lt;h3&gt;Calendar&lt;/h3&gt;
			<strong>
&lt;folks:FolksContainer ID="FolksContainer2" runat="server"&gt;</strong>
	&lt;asp:Calendar ID="Calendar1" runat="server" Width="350px" OnSelectionChanged="sampleCalendar_SelectionChanged"
		NextPrevFormat="FullMonth" Height="190px" ForeColor="Black" Font-Size="9pt" Font-Names="Verdana"
		BorderWidth="1px" BorderColor="White" BackColor="White"&gt;
		&lt;SelectedDayStyle BackColor="#333399" ForeColor="White" /&gt;
		&lt;TodayDayStyle BackColor="#CCCCCC" /&gt;
		&lt;OtherMonthDayStyle ForeColor="#999999" /&gt;
		&lt;NextPrevStyle Font-Bold="True" Font-Size="8pt" ForeColor="#333333" VerticalAlign="Bottom" /&gt;
		&lt;DayHeaderStyle Font-Bold="True" Font-Size="8pt" /&gt;
		&lt;TitleStyle BackColor="White" BorderColor="Black" BorderWidth="4px" Font-Bold="True"
			Font-Size="12pt" ForeColor="#333399" /&gt;
	&lt;/asp:Calendar&gt;
	&lt;asp:Label ID="Label2" runat="server"&gt;&lt;/asp:Label&gt; 
<strong>&lt;/folks:FolksContainer&gt;</strong>
		</pre>
	</div>
	<div id="source">
		<h4>Source</h4>
		<pre class="code_fixed sh_csharp">
namespace Sample
{
	public partial class CommonControls : System.Web.UI.Page
	{
		protected void sampleCheckBoxList_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (sampleCheckBoxList.SelectedItem != null)
				sampleCheckBoxLabel.Text = sampleCheckBoxList.SelectedItem.Text;
		}

		protected void sampleRadioButtonList_SelectedIndexChanged(object sender, EventArgs e)
		{
			ListItem item = sampleListBox.Items.FindByValue(sampleRadioButtonList.SelectedValue);
			if (item != null)
				sampleListBox.SelectedIndex = sampleListBox.Items.IndexOf(item);
		}

		protected void sampleListBox_SelectedIndexChanged(object sender, EventArgs e)
		{
			ListItem item = sampleRadioButtonList.Items.FindByValue(sampleListBox.SelectedValue);
			if (item != null)
				sampleRadioButtonList.SelectedIndex = sampleRadioButtonList.Items.IndexOf(item);
		}

		protected void sampleCalendar_SelectionChanged(object sender, EventArgs e)
		{
			sampleLabel.Text = sampleCalendar.SelectedDate.ToLongDateString();
		}
	}
}
		</pre>
	</div>
</asp:Content>
